package originatorV3;

import originatorV2.CollerOriginator;
import command.Command;

import mementoV2.CollerMemento;
import mementoV2.Memento;
import mementoV3.CollerMementoV3;
import mementoV3.MementoV3;
import caretakerV3.GestionDefaire;

public class CollerOriginatorV3 implements OriginatorV3 {


	public CollerOriginatorV3(Command command, GestionDefaire _gestion) {
		super();
		this._coller = command;
		this._gestion = _gestion;
	}

	private Command _coller;

	private GestionDefaire _gestion;

	@Override
	public void execute() {
		((CollerOriginator) _coller).execute();		
		MementoV3 m = new CollerMementoV3(this);
		_gestion.sauvegarder(m);
	}

	@Override
	public void setMemento(MementoV3 m) {
		Memento mem = new CollerMemento((CollerOriginator) _coller);
		((CollerOriginator) _coller).setMemento(mem);
	}

}
